package com.zzh.partnersys.chat.handler;

import com.google.gson.Gson;
import com.zzh.partnersys.chat.message.request.LoginRequestNotBindMessage;
import com.zzh.partnersys.chat.session.SessionFactory;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.ChannelHandler.Sharable;
/**
 * @author  zzh
 * @version 1.0
 * ?????
 */
@Sharable
public class LoginRequestNotBindMessageHandler extends SimpleChannelInboundHandler<LoginRequestNotBindMessage> {
    Gson gson = new Gson();

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, LoginRequestNotBindMessage loginRequestNotBindMessage) throws Exception {
        Long uid = loginRequestNotBindMessage.getFromUid();
        SessionFactory.getSession().unbind(ctx.channel());
        System.out.println("??????????uid="+uid+", channel=>"+SessionFactory.getSession().getChannel(uid));
    }

}
